﻿@using BonjourQuotation.UI.Models.SetupModel
@model SetupDetailsGridViewModel

@using (@Html.BeginForm("SaveDetailDetailData", "Setup", FormMethod.Post, new { id = "LoadDetailDetailsForm" }))
{
    <div id="ErrorMessagesDivPopUp" style="margin:auto;width:1150px; height: 30px; ">
        <label for="Validation" id="errorMessageClient" class="errorMessage"></label>
        @if (Model.Message != null)
        {
            @Html.LabelForModel(Model.Message, new { @class = "errorMessage", id = "errorMessageServer" })
        }
    </div>

    <div style="width:1161px; min-height:300px; max-height:442px; margin:auto; padding-bottom:30px; ">
        <table class="table table-bordered table-hover table-condensed" style="margin-bottom: -1px !important; width: 1140px;background-color:white;">
            <thead>
                <tr>
                    <th width="15%;" class="GridHeaders">Detail</th>
                    <th width="10%;" class="GridHeaders">Code</th>
                    <th width="15%;" class="GridHeaders">Description</th>
                    <th width="18%;" class="GridHeaders">Service</th>
                    <th width="7%;" class="GridHeaders">Time</th>
                    <th width="7%;" class="GridHeaders">Vendor</th>
                    <th width="7%;" class="GridHeaders">Guide</th>
                    <th width="7%;" class="GridHeaders">Address</th>
                    <th width="7%;" class="GridHeaders">Active</th>
                    <th width="7%;" class="GridHeaders">Delete</th>
                </tr>
            </thead>
        </table>
        <div style="height:350px; overflow-y:auto;">
            <table class="table table-bordered table-hover table-condensed" style="width: 1140px; table-layout: fixed; background-color: white;">
                <tbody>
                    @for (int ind = 0; ind < Model.Rows.Count; ind++)
                    {
                        @Html.HiddenFor(model => model.Rows[ind].DetailID)
                        Model.SelectedDetailDetailTypeID = Model.Rows[ind].DetailTypeID;
                        Model.SelectedDetailServiceTypeID = Model.Rows[ind].SelectedDetailServiceTypeID;
                        @Html.HiddenFor(model => model.Rows[ind].ServiceTypeID);
                        if(Model.MenuSetupDetailEdit)
                        { 
                            <tr>
                                <td width="15%;" style="text-align:left">
                                    @Html.DropDownListFor(model => Model.SelectedDetailDetailTypeID, new SelectList(Model.DetailTypeID, "Value", "Text"), new { @class = "table_inputs_162 table_inputs_WithoutBox ChangedDetailElements DetailElementsDrop DetailTypeDrop ForValidation Required", @style = "text-align: left" })
                                    @Html.DropDownListFor(model => Model.Rows[ind].DetailTypeID, new SelectList(Model.DetailTypeID, "Value", "Text"), new { @class = "RoomGridDropHide Required" })
                                </td>
                                <td width="10%;" style="text-align:left">@Html.TextBoxFor(model => model.Rows[ind].DetailCode, new { @class = "table_inputs_105 table_inputs_WithoutBox ChangedDetailElements ForValidation MaxLength20 Required", @style = "text-align: left" })</td>
                                <td width="15%;" style="text-align:left">@Html.TextBoxFor(model => model.Rows[ind].DetailDescription, new { @class = "table_inputs_162 table_inputs_WithoutBox ChangedDetailElements ForValidation MaxLength50 Required", @style = "text-align: left" })</td>
                                <td width="18%;" style="text-align:left">
                                    @Html.DropDownListFor(model => Model.SelectedDetailServiceTypeID, new SelectList(Model.Rows[ind].ServiceTypeID, "Value", "Text"), "Select", new { @class = "table_inputs_200 table_inputs_WithoutBox ChangedDetailElements DetailElementsDrop ForChangeSeriveTypesFromDetailTypes", @style = "text-align: left" })
                                    @Html.DropDownListFor(model => Model.Rows[ind].SelectedDetailServiceTypeID, new SelectList(Model.Rows[ind].ServiceTypeID, "Value", "Text"), "Select", new { @class = "RoomGridDropHide ForChangeSeriveTypesFromDetailTypesImit" })
                                </td>
                                <td width="7%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].TimeFlg, new { @class = "ChangedDetailElements" })</td>
                                <td width="7%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].VendFlg, new { @class = "ChangedDetailElements" })</td>
                                <td width="7%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].GuidFlg, new { @class = "ChangedDetailElements" })</td>
                                <td width="7%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].AddrFlg, new { @class = "ChangedDetailElements" })</td>
                                <td width="7%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].IsActive, new { @class = "ChangedDetailElements" })</td>
                                <td width="7%;" style="text-align:center"><button class="btn14 btn-danger btn60 btnheight22" type="button" onclick="DeleteDetail(@Model.Rows[ind].DetailID)">Delete</button></td>
                            </tr>
                        }
                        else
                        {
                            <tr>
                            <td width="15%;" style="overflow: hidden">
                                @Html.DropDownListFor(model => Model.SelectedDetailDetailTypeID, new SelectList(Model.DetailTypeID, "Value", "Text"), new { @class = "table_inputs_190 table_inputs_WithoutBox DisabledDropDown", @disabled = "disabled", @style = "font-weight:bold" })
                                @Html.DropDownListFor(model => Model.Rows[ind].DetailTypeID, new SelectList(Model.DetailTypeID, "Value", "Text"), new { @class = "RoomGridDropHide Required" })
                            </td>
                            <td width="10%;">@Html.LabelForModel(Model.Rows[ind].DetailCode, new { @class = "table_inputs_114", @style = "text-align: left" })</td>
                            <td width="15%;">@Html.LabelForModel(Model.Rows[ind].DetailDescription, new { @class = "table_inputs_172", @style = "text-align: left" })</td>
                            <td width="18%;" style="overflow: hidden">
                                @Html.DropDownListFor(model => Model.SelectedDetailServiceTypeID, new SelectList(Model.Rows[ind].ServiceTypeID, "Value", "Text"), "", new { @class = "table_inputs_220 table_inputs_WithoutBox DisabledDropDown", @disabled = "disabled", @style = "font-weight:bold" })
                                @Html.DropDownListFor(model => Model.Rows[ind].SelectedDetailServiceTypeID, new SelectList(Model.Rows[ind].ServiceTypeID, "Value", "Text"), "Select", new { @class = "RoomGridDropHide ForChangeSeriveTypesFromDetailTypesImit" })
                            </td>
                            <td width="7%;">@Html.LabelForModel(Model.Rows[ind].TimeFlg ? "Yes" : "No", new { @class = "table_inputs_80", @style = "text-align: left" })</td>
                            <td width="7%;">@Html.LabelForModel(Model.Rows[ind].VendFlg ? "Yes" : "No", new { @class = "table_inputs_80", @style = "text-align: left" })</td>
                            <td width="7%;">@Html.LabelForModel(Model.Rows[ind].GuidFlg ? "Yes" : "No", new { @class = "table_inputs_80", @style = "text-align: left" })</td>
                            <td width="7%;">@Html.LabelForModel(Model.Rows[ind].AddrFlg ? "Yes" : "No", new { @class = "table_inputs_80", @style = "text-align: left" })</td>
                            <td width="7%;">@Html.LabelForModel(Model.Rows[ind].IsActive ? "Yes" : "No", new { @class = "table_inputs_80", @style = "text-align: left" })</td>
                            <td width="7%;" style="text-align:center"><button class="btn14 btn-danger btn60 btnheight22" type="button" disabled="disabled" onclick="DeleteDetail(@Model.Rows[ind].DetailID)">Delete</button></td>
                        </tr>
                        }
                    }
                </tbody>
            </table>
        </div>
    </div>
}
<div style="float: right; height: 25px; width: 140px; margin-right: 45px; ">
    <button class="btn14 btn60" style="float: left;@(@Model.IsCanView ? "" : "Display:none ")" type="button" id="DetailMoreBtn">More</button>
    @if(Model.MenuSetupDetailEdit)
    { 
        <button class="btn14 btn50" style="float: right;" type="button" id="DetailDetailsSaveBtn">Save</button>
    }
    else
    { 
        <button class="btn14 btn50" style="float: right;" type="button" disabled="disabled" id="DetailDetailsSaveBtn">Save</button>
    }
</div>
